package com.example.resource_station_backend.dao;


import com.example.resource_station_backend.model.entity.Category;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * @Author xinhao
 * @Description
 * @CreateTime 2025-02-25 15:46:51
 */
@Repository
public interface CategoryRepository extends JpaRepository<Category, Long> {
    // 按 category_id 查询
    Optional<Category> findById(Long categoryId);
    // 按 name 查询
    Optional<Category> findIdByName(String name);
    // 判断分类名存在
    boolean existsByName(String name);
}
